<?php
$submit=array(
    'name'=>'submit',
    'class'=>'submit',
    'type'=>'submit',
    'value'=>'提交修改',
    'id'=>'addcourse_submit'
);
//教师列表
$teacherid_options=array();
foreach($teacherid as $i) {
    $teacherid_options[$i->id]=$i->username;
}
$coursename=array(
    'type'=>'text',
    'class'=>'text',
    'name'=>'coursename',
);
$courseid='';
foreach($course->result() as $row) {
//课程名称
    $coursename['value']=$row->coursename;
    $courseid=$row->id;
}
//对应老师
$selected=$teacher;
?><head>
    <?php $this->load->view('load_view'); ?>
</head>
<script>
    $(function(){
        var $coursename=$('div.manageform input.text');
        var $c_v=$coursename.val();
        var $teacherid=$('div.manageform select option[selected=selected]').val();
        var $t_id=$('div.manageform select option[value='+$teacherid+']')
        var $t_v=$teacherid;
        var $repeal=$('#repeal');
        $repeal.click(function(){
            $coursename.val($c_v);
            $t_id.attr('selected','selected');
        })
    })
</script>
<div class="col-wrap handin-wrap">
    <!--start col-->
    <div class="col handin">
        <div class="wrap-title">
            <p class="page-title">编辑课程</p>
        </div>

        <p class="desc bg">
    	页面提示：修改课程信息
        </p>
        <!--start syllabue-wrap-->
        <div class="arrange manageform">
            <?php
            echo form_open("admin/syllabus/editcourse/$courseid/false/$year",array('class'=>'syllabus','id'=>'addcourse'));
            ?>
            <p>
                <?php
                echo form_label('课程名称');
                echo form_input($coursename);
                ?>
            </p>
            <p>
                <?php
                echo form_label('老师');
                echo form_dropdown('teacherid',$teacherid_options,$selected);
                ?>
            </p>
            <?php echo form_input($submit); ?>
            <p class="control">
                <a href="javascript:" id="repeal">撤销修改</a>
                <a href="javascript: history.go(-1)">返回修改</a>
            </p>
        </div>
        <!--end syllabus-wrap-->
        <?php echo form_close(); ?>
    </div>
    <!--end col-->
</div>
<!--end col-wrap-->
<script>
    $(window.parent.document).find("ul.nav li a").removeClass("then");
    $(window.parent.document).find("a#syllabus").attr("class","then");
</script>
